'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
    async up(queryInterface, Sequelize) {
        await queryInterface.createTable('users', {
            id: {
                type: Sequelize.INTEGER.UNSIGNED,
                autoIncrement: true,
                primaryKey: true,
            },
            username: {
                type: Sequelize.STRING(128),
                allowNull: false,
                unique: true,
            },
            password: {
                type: Sequelize.STRING(128),
                allowNull: false,
            },
            email: {
                type: Sequelize.STRING(128),
                allowNull: false,
                unique: true,
            },
            bio: {
                type: Sequelize.STRING(255),
                allowNull: true,
            },
            avatar: {
                type: Sequelize.STRING(255),
                allowNull: true,
            },
            gender: {
                type: Sequelize.ENUM('male', 'female', 'other'),
                allowNull: true,
            },
            age: {
                type: Sequelize.INTEGER.UNSIGNED,
                allowNull: true,
            },
            birthDate: {
                type: Sequelize.DATEONLY,
                allowNull: true,
                comment: '出生日期'
            },
            zodiacSign: {
                type: Sequelize.STRING(32),
                allowNull: true,
                comment: '星座'
            },
            location: {
                type: Sequelize.STRING(255),
                allowNull: true,
                comment: '位置信息'
            },
            createdAt: {
                type: Sequelize.DATE,
                allowNull: false,
            },
            updatedAt: {
                type: Sequelize.DATE,
                allowNull: false,
            }
        });
    },

    async down(queryInterface, Sequelize) {
        await queryInterface.dropTable('users');
    }
}; 